|
|
 |
|
|
|
|
picCanvas.ScaleHeight), vbBlack, BF
DoEvents
' Get the image's pixels. GetBitmapPixels picCanvas, pixels, bits_per_pixel
' Adjust the coordinate bounds to fit picCanvas. adjustAspect
' dReaZO is the change in the real part
' (X value) for ZO. dImaZO is the change in the
' imaginary part (Y value). wid = picCanvas.ScaleWidth
hgt = picCanvas.ScaleHeight
dReaZ0 = (m_Xmax - m_Xmin) / (wid - 1)
dImaZ0 = (m_Ymax - m_Ymin) / (hgt - 1)
' Calculate the values. ReaZ0 = m_Xmin
For i = 0 To wid - 1
ImaZ0 = m_Ymin
For j = 0 To hgt - 1
ReaZ = ReaZ0
ImaZ = ImaZ0
ReaZ2 = ReaZ * ReaZ
ImaZ2 = ImaZ * ImaZ
clr = 1
Do While clr < MaxJuliaIterations And _
ReaZ2 + ImaZ2 < MAX_MAG_SQUARED ' Calculate Z(clr). ReaZ2 = ReaZ * ReaZ
ImaZ2 = ImaZ * ImaZ
ImaZ = 2 * ImaZ * ReaZ + m_Julia_ImaC
ReaZ = ReaZ2 - ImaZ2 + m_Julia_ReaC
clr = clr + 1
Loop
If clr >= MaxJuliaIterations Then ' Use a non-background color. color = m_Colors(((ReaZ2 + ImaZ2) * _
(numcolors - 1)) Mod _
(numcolors - 1) + 1)
Else ' Use the background color. color = m_Colors(1)
End If
With pixels(i, j)
.rgbRed = color And &HFF&
.rgbGreen = (color And &HFF00&) \ &H100&
.rgbBlue = (color And &HFF0000) \ &H10000
End With |
|
|
|
|
|